package com.example.activitidemo.service.connector;

import com.example.activitidemo.service.ExampleService;
import lombok.extern.slf4j.Slf4j;
import org.activiti.api.process.model.IntegrationContext;
import org.activiti.api.process.runtime.connector.Connector;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * activiti7的serviceTask关联的具体执行方法
 * service的名字应当唯一
 */

@Slf4j
@Service(value = "serviceTask3Connector")
public class ServiceTask3Connector implements Connector {

    @Autowired
    private ExampleService exampleService;

    @Override
    public IntegrationContext apply(IntegrationContext integrationContext) {
        log.info("Task 3 ... [processInstanceId=" + integrationContext.getProcessInstanceId() + "]");
        log.info("InBoundVariables: " + integrationContext.getInBoundVariables());
        log.info("OutBoundVariables: " + integrationContext.getOutBoundVariables());
        log.info(exampleService.printMsg());
        return integrationContext;
    }
}